define(function() {
	//给类型实例添加方法
	if(typeof Function.prototype.addMethod !== "function") {
		Function.prototype.addMethod = function(name, func) {
			if(this.prototype[name]) return;
			this.prototype[name] = func;
			return this;
		}
	}
	//继承一个对象
	if(typeof Object.extend !== "function") {
		if(Object.create) {
			Object.extend = Object.create;
		} else {
			Object.extend = function(obj) {
				var F = function() {};
				F.prototype = obj;
				return new F();
			}
		}
	}

	//扩展Number类，获取数字类型的整数部分
	Number.addMethod("getInteger", function() {
		return Math[this < 0 ? 'ceil' : 'floor'](this);
	});
	Number.getInteger = function(num) {
		if(typeof num !== "number") {
			throw new TypeError("please pass a number");
		}
		return Math[num < 0 ? 'ceil' : 'floor'](num);
	}
	//扩展Number类，判断数字是否是浮点数
	Number.addMethod("isFloat", function() {
		return this.toString().indexOf(".") > 0;
	});

	Number.isFloat = function(num) {
		if(typeof num !== "number") {
			throw new TypeError("please pass a number");
		}
		return num.toString().indexOf(".") > 0;
	}
	String.addMethod("trimLeft", function() {
		return this.replace(/^\s+/g, '');
	})
	String.addMethod("trimRight", function() {
		return this.replace(/\s+$/g, '');
	})
	String.addMethod("trim", function() {
		return this.replace(/^\s+|\s+$/g, '');
		//return this.trimLeft().trimRight();
	});
	
	//兼容ie
    if (!window.location.origin) {
        window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port : '');
    }
    
})